// Sprite klasse
// Created by Ruben Rigole

#pragma once

class GameEngine;

class Sprite
{
public:
	Sprite(const tstring& file, const D3DXVECTOR3& pos, int count = 1);
	virtual ~Sprite();

	ID3D10Texture2D* GetTextureFromFile(const tstring& file) const;
	void CreateResourceView(ID3D10Texture2D* texture, ID3D10ShaderResourceView ** view);

	void SetPosition(const D3DXVECTOR3& pos);
	float GetWidth() const;
	float GetHeight() const;
	void Tick(float dTime);
	void SetScale(const D3DXVECTOR3& scale);
	void SetStep(int step);

	void Update();
	
	const D3DXVECTOR3& GetPosition() const;
	D3DX10_SPRITE GetSprite() const;

private:
	float m_OldTime;
	int m_CurrStep, m_MaxStep;
	ID3D10ShaderResourceView* m_ResourcePtr;
	ID3D10Texture2D* m_TexturePtr;
	D3DXVECTOR3 m_Pos, m_OrigPos;
	D3DX10_SPRITE m_Sprite;
	D3DXMATRIX m_World, m_Scale, m_Tran;

	float m_Width, m_Height;

	Sprite(const Sprite &t);
	Sprite& operator= (const Sprite &t);
};